home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / PredatorPrey / calc_mousedown.c < prev    next >
Text File  |  1996-06-22  |  33KB  |  1,134 lines

  1.  
  2.             /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
  3.             /*                                                               */
  4.             /*                    Prototype HP15C Calculator                */
  5.             /*                    James C. Ullrey                            */
  6.             /*                    INRESCO                                    */
  7.             /*                    © 1990                                    */
  8.             /*                    Version    13.97a                            */
  9.             /*                                                               */
  10.             /*                    MOUSEDOWN SEGMENT                           */
  11.             /*                                                               */
  12.             /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * **/
  13.  
  14.  
  15. /*****************************************************************/
  16. /*  I N C L U D E S
  17. /*****************************************************************/
  18. #include "EditM.h"
  19. #ifndef __C14__
  20. #include    "PredatorPrey.h"
  21. #endif
  22. #include    <Processes.h>
  23. #include    "windows.h"
  24. #include    "calc_contents.h"
  25. #include    "calc_controls.h"
  26. #include    "ResourceDefs.h"
  27. #include    "calc_dork.h"
  28. #include    "Globals.h"
  29.  
  30. #include    "HelpGetProc.h"
  31.  
  32.  
  33.  
  34. #include    "ProgramM.h"
  35. #include    "ProgramWindow.h"
  36. #include    "Windowing.h"
  37. #include    "YEquals.h"
  38. #include    "ZoomM.h"
  39. #include    "PlotM.h"
  40. #include    <EPPC.h>
  41. #include    <PPCToolbox.h>
  42. #include    <AppleEvents.h>
  43. #include    <Aliases.h>
  44. #include    <Files.h>
  45. #include    <Dialogs.h>
  46.  
  47. #include    "DialogAids.h"
  48. #ifndef __CIN__
  49. #include    "calc_inits.h"
  50. #endif
  51.  
  52. #include    "calc_update.h"
  53. #include    "calc_files.h"
  54. #include    "calc_mousedown.h"
  55. #include    "calc_handlebutton.h"
  56. #include    "create_prey.h"
  57.  
  58. /********************************************************************
  59. /*  G L O B A L   V A R I A B L E   D E C L A R A T I O N S
  60. /********************************************************************/
  61.  
  62. #define kFinderType 'FNDR'
  63. #define kSysCreator 'MACS'
  64. #define kAEOpenSelection 'sope'
  65. #define aeSelectionKeyword 'fsel'
  66. #define localLaunch 1
  67. #define localWindow 2
  68. #define remoteLaunch 3
  69.  
  70. #define kResumeMask 1             /* bit of message field for resume vs. suspend */
  71. #define kTextType 'TEXT'
  72. #define kTextResID 128
  73. #define kPathDialog 133
  74. #define kEditLineItem 4
  75. #define kColon ':'
  76.  
  77. enum
  78. {
  79.     kGenStrings = 128, kPPCPrompt1 = 1, kPPCPrompt2
  80. };
  81.         EventRecord gERecord;                    /*    EventRecord    */
  82.         
  83. //#define    DEBUGGING            TRUE
  84.  
  85. extern    Boolean        scrapDirty;
  86. //extern    WindowPtr    theWPtr;
  87. extern    Boolean        Transmogrified;
  88. extern    Boolean        Iconized;
  89. extern    Boolean        oldWay;
  90. extern    short        gErrorFlag;
  91. extern    short        ErrorZero;
  92. extern    short        ErrorOne;
  93. extern    short        ErrorTwo;
  94. extern    short        ErrorThree;
  95. extern    short        ErrorFour;
  96. extern    short        ErrorFive;
  97. extern    short        ErrorSix;
  98. extern    short        ErrorSeven;
  99. extern    short        ErrorEight;
  100. extern    short        ErrorNine;
  101. extern    short        ErrorTen;
  102. extern    short        ErrorEleven;
  103.  
  104. extern    long        gState;
  105. extern    long        delayTime;
  106. extern    long        gsState;
  107. extern    long         sto;
  108. extern    long         rcl;
  109. extern    long         gNewNum;
  110. /*extern    long     canClear;*/
  111. extern    long         gRoll;
  112. extern    long         wait;
  113. extern    long         gFlag;
  114. extern    long         fFlag;
  115. extern    long         sWait;
  116. extern    long         rWait;
  117. extern    long         lblWait;
  118. extern    long         plus;
  119. extern    long         minus;
  120. extern    long         timesF;
  121. extern    long         divide;
  122. extern    long         gDot;
  123. /*extern    long     rsFlag;*/
  124. extern    long        gDigits;
  125. /*extern    long    runMode;*/
  126. /*extern    long    gsbWait;*/
  127. extern    long        gtoWait;
  128. extern    short        sRefNum;
  129. extern    short        rRefNum;
  130. extern    short        qRefNum;
  131. extern    short        pRefNum;
  132. extern    short        gWindowState;
  133. extern    short        gMatWin;    
  134. extern    short        gRegWin;
  135. extern    short        gProgWin;
  136. extern    Rect        gDragRect;
  137. extern    Rect        gNoColorDragRect;
  138. extern    Boolean        gLoadProgEnabled;
  139. extern    Str255        theFrogName;
  140. extern    /*static*/    short    theVRefNum;
  141. extern    WindowPtr    lastPtr;
  142. extern    Boolean        gIsWizard;
  143. extern    Boolean        stillWizard;
  144. extern    Boolean        hasPlot;
  145. extern    short        kNumMyHelpItems;
  146.  
  147. /*****************************************************************/
  148. /*  P R O T O T Y P E S
  149. /*****************************************************************/
  150.  
  151.         void        TimingLoop            (void);
  152.         void        HandleAppleChoice    (short theItem);
  153.         void        HandleFileChoice    (short theItem);
  154.         void        HandleEditChoice    (short theItem);
  155.         void        HandleWindowChoice    (short theItem);
  156.         void        HandleProgramChoice    (short theItem);
  157.         void        HandleGraphChoice    (short theItem);
  158.         void        HandleGraphSubChoice    (short theItem);
  159.         void        HandleDorkChoice    ( short theItem );
  160.         void        HandlePlotChoice    ( short theItem );
  161.         void        MyHandleHelpCommand(short theItem );
  162. //extern    Rect        *WinRect            ( WindowPtr    wptr, Rect    *scrRect );
  163. //extern    void        DoKiller            (void);
  164. //extern    WindowPtr    get_window            (short    selector);
  165. //extern    WindowPtr    get_rotation_box    (void);
  166. //extern    WindowPtr    get_stretch_box        (void);
  167.  
  168. //extern    void        do_grow                (WindowPtr  wPtr,  Point global_pt);
  169.         OSErr             FindAProcess        (
  170.                                             OSType typeToFind,OSType creatorToFind,
  171.                                             ProcessSerialNumberPtr processSN,
  172.                                             ProcessInfoRecPtr infoRecToFill
  173.                                         );
  174.         pascal    Boolean    idleProc        (EventRecord *eventIn, long *sleep, RgnHandle *mouseRgn);
  175.         
  176.         pascal    Boolean    FinderFilter    (LocationNamePtr locationName, PortInfoPtr thePortInfo);
  177.                 OSErr    GetPathAndName    (Str255 fullPath, Str255 appName);
  178.                 void    DrawMain        (WindowPtr drawIt);
  179.                 
  180.         ControlHandle    SnatchHandle    (DialogPtr thebox, short theGetItem);
  181.  
  182. static void        DoUndo (void);
  183. static void        DoCut (void);
  184. static void        DoCopy (void);
  185. static void        DoPaste (void);
  186. static void        DoClear (void);
  187.         
  188.         
  189.         
  190. /*****************************************************************/
  191. /*****************************************************************/
  192. /*                                                                 */
  193. /* R O U T I N E S                                                 */
  194. /*                                                                 */
  195. /*****************************************************************/
  196. /*****************************************************************/
  197.  
  198.  
  199. void    mousedown_seg() {}        /*  for reference in "UnloadSeg()" calls    */
  200.  
  201.  
  202. /*----------*/
  203. /*static void DoYEquals(void)*/
  204. /*{*/
  205. /*    YEqualsRec                YEqualsInfo;*/
  206. /*    register YEqualsRecPtr    info;*/
  207. /**/
  208. /*    info = &YEqualsInfo;*/
  209. /*    /*initialize AddC info»*/
  210. /*    info->Field7Text [0] = 0;*/
  211. /*    info->Field8Text [0] = 0;*/
  212. /*    info->Field13Text [0] = 0;*/
  213. /*    info->List9Choice = -1;*/
  214. /*    */
  215. /*    if (GetYEquals (&YEqualsInfo)) {        /* in YEquals.c    »*/
  216. /*        /*use YEquals info»*/
  217. /*    }*/
  218. /*}*/ /*DoYEquals*/
  219.  
  220.  
  221. /********************** TimingLoop ************************/
  222. void    TimingLoop()
  223. {
  224.     long first;
  225.     long second;
  226.     long delayTime = 6;
  227.     
  228.     if(Transmogrified)
  229.     {
  230.         first = delayTime;
  231.     }
  232.     else
  233.     {
  234.         first = 6;
  235.     }
  236.     #ifdef fast
  237.     #else
  238.         Delay(first,&second);
  239.     #endif
  240.  
  241. }
  242.  
  243.  
  244. /********************** HandleMouseDown ************************/
  245. void    HandleMouseDown()
  246. {
  247.     WindowPtr        whichWindow;
  248.     short             thePart,control_part;
  249.     long            menuChoice;
  250.     long            windSize,dummy;
  251.     long            startTick1,stopTick1,startTick2,stopTick2;
  252.     long            oldTime,newTime;
  253.     short            myItemHit;
  254.     short            calcCol,calcRow;
  255.     Point            myPoint;
  256.     GrafPtr            oldPort;
  257.     Point            pt,pt2;
  258.     Rect            scrRect;
  259.     Point            where;
  260.     ControlHandle     cntl_hndl;
  261.     WRObjsHandle    wr_objs_hndl;
  262.     WSObjsHandle    ws_objs_hndl;
  263.     
  264.     thePart = FindWindow( gTheEvent.where, &whichWindow );
  265.     switch ( thePart )
  266.     {
  267.         case inMenuBar :
  268.             menuChoice = MenuSelect( gTheEvent.where );
  269.             HandleMenuChoice( menuChoice );
  270.             break;
  271.         case inSysWindow : /* By clicking Apple icon and dragging to DA */
  272.             SystemClick( &gTheEvent, whichWindow );
  273.             break;
  274.         case inDrag :
  275.             DragWindow( whichWindow, gTheEvent.where, &gDragRect );
  276.             break;
  277.         case inGrow:
  278.             if ( one_of_mine(whichWindow) )
  279.             {
  280.                 do_grow(whichWindow, gTheEvent.where);    /* calc_update.c    */
  281.             }
  282.             break;
  283.         case inGoAway :
  284.             if (TrackGoAway(whichWindow, gTheEvent.where))
  285.             {
  286.                  if ( one_of_mine(whichWindow) )
  287.                  {
  288.                      save_window(whichWindow);    /*    in calc_files.c    */
  289.                  }
  290.                  else if(whichWindow == gRotateBox)
  291.                  {
  292.                      wr_objs_hndl = (WRObjsHandle)GetWRefCon(gRotateBox);
  293.                      if(wr_objs_hndl != NIL)
  294.                     {
  295.                         HLock((Handle)wr_objs_hndl);
  296.                         /*if((**wr_objs_hndl).prInfoHndl)    DisposHandle((**wr_objs_hndl).prInfoHndl);*/
  297.                         DisposHandle((Handle)wr_objs_hndl);
  298.                     }
  299.                     
  300.                     DisposeWindow(gRotateBox);    /*  also does a "KillControls()"    */
  301.                     gRotateBox = NIL;
  302.  
  303.                      EnableItem(GetMHandle(DORK_MENU_ID), 2);
  304.                  }
  305.                  else if(whichWindow == gStretchBox)
  306.                  {
  307.                      ws_objs_hndl = (WSObjsHandle)GetWRefCon(gStretchBox);
  308.                      if(ws_objs_hndl != NIL)
  309.                     {
  310.                         HLock((Handle)ws_objs_hndl);
  311.                         /*if((**ws_objs_hndl).prInfoHndl)    DisposHandle((**ws_objs_hndl).prInfoHndl);*/
  312.                         DisposHandle((Handle)ws_objs_hndl);
  313.                     }
  314.                     
  315.                     DisposeWindow(gStretchBox);    /*  also does a "KillControls()"    */
  316.                     gStretchBox = NIL;
  317.                      EnableItem(GetMHandle(DORK_MENU_ID), 3);
  318.                  }
  319.              }
  320.             /*gDone = TRUE;*/
  321.             
  322.             break;
  323.         case inContent :
  324.             if ( one_of_mine(whichWindow) )
  325.             {
  326.                 if (whichWindow != FrontWindow())
  327.                     SelectWindow( whichWindow );
  328.                 else
  329.                   {
  330.                     SetPort(whichWindow);
  331.                     myPoint = gTheEvent.where;
  332.                      GlobalToLocal(&myPoint);
  333.                      
  334.                      if((control_part = FindControl(myPoint, whichWindow, &cntl_hndl)))
  335.                      {
  336.                            do_controls(myPoint, whichWindow, cntl_hndl, control_part);
  337.                     }
  338.                     else
  339.                     {
  340.                         draw_contents(whichWindow, &gTheEvent);    /* in calc_contents.c */
  341.                     }
  342.                  }
  343.             }
  344.             else if    ( whichWindow == gStretchBox )
  345.             {
  346.                 if (whichWindow != FrontWindow())
  347.                     SelectWindow( whichWindow );
  348.                 do_stretch_box(whichWindow,&gTheEvent);    /* in calc_contents.c */
  349.             }
  350.             else if ( whichWindow == gRotateBox )
  351.             {
  352.                 if (whichWindow != FrontWindow())
  353.                     SelectWindow( whichWindow );
  354.                 do_rotate_box(whichWindow,&gTheEvent);    /* in calc_contents.c */
  355.             }
  356.             else
  357.             {
  358.                 DoKiller();
  359.             }
  360.             break;
  361.     }
  362. }    /*    calc_mousedown.c    */
  363. /******************* end of HandleMouseDown *********************/
  364.  
  365. /********************** HandleMenuChoice ************************/
  366. void    HandleMenuChoice(long menuChoice )
  367. {
  368.     short    theMenu;
  369.     short    theItem;
  370.     
  371.     if ( menuChoice != 0 )
  372.     {
  373.         theMenu = HiWord( menuChoice );
  374.         theItem = LoWord( menuChoice );
  375.         switch ( theMenu )
  376.         {
  377.             case APPLE_MENU_ID :
  378.                     HandleAppleChoice( theItem );
  379.                     break;
  380.             case FILE_MENU_ID :
  381.                     HandleFileChoice( theItem/*, &theFileName, &theVRefNum */);
  382.                     break;
  383.             case EDIT_MENU_ID :
  384.                     /*HandleEditChoice( theItem );*/
  385.                     DoEdit( theItem );
  386.                     break;
  387.         //    case WINDOW_MENU_ID :
  388.         //            HandleWindowChoice( theItem );
  389.         //            break;
  390.         //    case PROGRAM_MENU_ID :
  391.         //            HandleProgramChoice( theItem );
  392.         //            break;
  393.             case GRAPHICS_MENU_ID:
  394.                     HandleGraphChoice( theItem );
  395.                     break;
  396.             case GRAPHICS_SUBMENU_ID:
  397.                     HandleGraphSubChoice( theItem );
  398.                     break;
  399.             case DORK_MENU_ID:
  400.                     HandleDorkChoice( theItem );
  401.                     break;
  402.             /*case PLOT_MENU_ID:*/
  403.                     /*HandlePlotChoice( theItem );*/
  404.                     /*break;*/
  405.         //    case PlotID:
  406.         //            DoPlot( theItem );
  407.         //            break;
  408.         //    case ZoomID:
  409.         //            DoZoom ( theItem );
  410.         //            break;
  411.         //    case WizardMenuID:
  412.         //            DoWizardMenu( theItem );
  413.         //            break;
  414.             case PreyMenuID:
  415.                     DoPreyMenu( theItem );
  416.                     break;
  417.         //    case kHMHelpMenuID:
  418.         //            MyHandleHelpCommand( theItem );
  419.         //            break;
  420.  
  421.         }
  422.     }
  423.     HiliteMenu( 0 );    
  424.  
  425. }
  426.  
  427. /********************** HandleAppleChoice ************************/
  428. void    HandleAppleChoice(short theItem )
  429. //short     theItem;
  430. {
  431.     Str255        accName;
  432.     short        accNumber;
  433.     short        itemNumber;
  434.     
  435.     switch ( theItem )
  436.     {
  437.         case ABOUT_ITEM_ID :
  438.                 NoteAlert( ABOUT_ALERT, NIL_POINTER );
  439.                 break;
  440.     //    case HELP_ITEM :
  441.     //            /*HelpGetProc();*/
  442.     //            GetHelp();    /* in calc_help.c    */
  443.     //            break;
  444.     //    case ALT_HELP_ITEM:
  445.     //            if(TRUE)
  446.     //            {
  447.     //                HelpGetProc();
  448.     //            }
  449.     //            else
  450.     //            {
  451.     //                GetFooling();
  452.     //            }
  453.     //            break;
  454.         default :
  455.                 GetItem( gAppleMenu, theItem, accName );
  456.                 accNumber = OpenDeskAcc( accName );
  457.                 break;
  458.     }
  459. }
  460.  
  461.  
  462.  
  463. /********************** HandleFileChoice ************************/
  464. void    HandleFileChoice(short theItem/*, fn, refNum*/ )
  465. //short    theItem;
  466. /*Str255        *fn;*/
  467. /*int            *refNum;*/
  468.  
  469. {
  470.     Str255         theLogFileName = "\pHP15C_Log";
  471.     Str255         theOtherLogFileName = "\pHP15C_Log_2";
  472.     WindowPtr    whichWindow;
  473.     Str255        timeString;
  474.     long        countDownTime;
  475.     short        itemType;
  476.     Rect        itemRect;
  477.     OSErr         error;
  478.     Handle        itemHandle;
  479.     long        count,fcount;
  480.     Boolean        checkIt;
  481.     static        short    logState;
  482.     
  483.     count = sizeof(map);
  484.     fcount = sizeof(frog);
  485.     switch ( theItem )
  486.     {
  487.         case    OPEN_DATA_FILE_ITEM :                        /*    Item 1    */
  488.                     
  489.                     DisableItem(GetMHandle(FILE_MENU_ID), 1);    /* Open Calculator */
  490.                     EnableItem(GetMHandle(FILE_MENU_ID), 2);    /* Save Data */
  491.                     EnableItem(GetMHandle(FILE_MENU_ID), 3);    /* Save Program */
  492.                     EnableItem(GetMHandle(FILE_MENU_ID), 4);    /* New Program */
  493.                     if(gLoadProgEnabled)
  494.                     {
  495.                         DisableItem(GetMHandle(FILE_MENU_ID), 5);    /* CLOSE_PROGRAM */
  496.                         EnableItem(GetMHandle(FILE_MENU_ID), 6);    /* LOAD_PROGRAM  */
  497.                     }
  498.                     else
  499.                     {
  500.                         EnableItem(GetMHandle(FILE_MENU_ID), 5);    /* CLOSE_PROGRAM */
  501.                         DisableItem(GetMHandle(FILE_MENU_ID), 6);    /* LOAD_PROGRAM  */                        
  502.                     }
  503.                     DisableItem(GetMHandle(FILE_MENU_ID), 7);    /* LOAD_DATA  */                    
  504.                     EnableItem(GetMHandle(FILE_MENU_ID), 8);    /* CLOSE_CALCULATOR  */
  505.                     //EnableItem(GetMHandle(WINDOW_MENU_ID), 1);
  506.                     //EnableItem(GetMHandle(WINDOW_MENU_ID), 2);
  507.                     //EnableItem(GetMHandle(PROGRAM_MENU_ID), 1);
  508.                     //EnableItem(GetMHandle(PROGRAM_MENU_ID), 2);
  509.                     break;
  510.         case    SAVE_DATA_FILE_ITEM :                                /*    Item 2    */
  511.                     if(gIsWizard)
  512.                     {
  513.                         /*StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);*/
  514.                         DoWizSaveData();
  515.                     }
  516.                     else
  517.                     {                        
  518.                         error = SetFPos(qRefNum,1,0);            /* II-93, IV-110    */
  519.                         error = FSWrite(qRefNum,&count,&map);    /* II-92, IV-110     */
  520.                         error = FlushVol(NIL,theVRefNum);
  521.                     }
  522.                     break;                    
  523.         case    CLOSE_ITEM :                        /*    Item 3    */
  524.     
  525.                         break;
  526.     //    case    NEW_PROGRAM_ITEM:                        /*    Item 4    */
  527.     //                if(gIsWizard)
  528.     //                {
  529.     //                    #ifdef      powerc
  530.     //                        StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);
  531.     //                    #else
  532.     //                        StopAlert (UNDER_CONSTRUCTION,    NIL);
  533.     //                    #endif      /* powerc */    
  534.     //                    DoWizNew();
  535.     //                }
  536.     //                break;
  537.     //    
  538.     //    case    CLOSE_PROGRAM_ITEM :                    /*    Item 5    */
  539.     //                if(gIsWizard)
  540.     //                {
  541.     //                    /*StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);*/
  542.     //                    DoWizClose();
  543.     //                }
  544.     //                else
  545.     //                {
  546.     //                    error = SetFPos(pRefNum,1,0);
  547.     //                    error = FSWrite(pRefNum,&fcount,&frog);
  548.     //                    error = FSClose(pRefNum);
  549.     //                    error = FlushVol(NIL,theVRefNum);
  550.     //                    if(!error)
  551.     //                    {
  552.     //                        gLoadProgEnabled = TRUE;
  553.     //                        DisableItem(GetMHandle(FILE_MENU_ID), 5);
  554.     //                        EnableItem(GetMHandle(FILE_MENU_ID), 6);
  555.     //                    }
  556.     //                }
  557.     //                break;
  558.     //    case    LOAD_PROGRAM_ITEM :                        /*    Item 6    */
  559.     //                if(gIsWizard)
  560.     //                {
  561.     //                    /*StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);*/
  562.     //                    DoWizOpenProg();
  563.     //                }
  564.     //                else
  565.     //                {
  566.     //                    error = FSOpen(theFrogName, theVRefNum, &pRefNum);
  567.     //                    if(error == opWrErr)
  568.     //                    {
  569.     //                        Alert(FILE_OPEN,NIL);
  570.     //                    }
  571.     //                    else if(error == fnfErr || error == bdNamErr)
  572.     //                    {
  573.     //                        Alert(NO_FILE,NIL);
  574.     //                    }
  575.     //                    else
  576.     //                    {
  577.     //                        error = SetFPos(pRefNum,1,0);                /* II-93, IV-110    */
  578.     //                        error = FSRead(pRefNum,&fcount,&frog);        /* II-92, IV-109    */
  579.     //                        if(!error)
  580.     //                        {
  581.     //                            gLoadProgEnabled = FALSE;
  582.     //                            EnableItem(GetMHandle(FILE_MENU_ID), 5);    /* CLOSE_PROGRAM */
  583.     //                            DisableItem(GetMHandle(FILE_MENU_ID), 6);    /* LOAD_PROGRAM  */
  584.     //                        }
  585.     //                    }
  586.     //                }
  587.     //                break;
  588.     //    case    LOAD_DATA_ITEM :                        /*    Item 7    */
  589.     //                if(gIsWizard)
  590.     //                {
  591.     //                    /*StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);*/
  592.     //                    DoWizOpenData();
  593.     //                }
  594.     //                else
  595.     //                {
  596.     //                    #ifdef      powerc
  597.     //                        
  598.     //                        //StopAlert (UNDER_CONSTRUCTION, (UniversalProcPtr)NIL);
  599.     //                    #else
  600.     //                        //DoBremOpenData();
  601.     //                        //StopAlert (UNDER_CONSTRUCTION,    NIL);
  602.     //                    #endif      /* powerc */    
  603.     //                }
  604.     //                break;
  605.     //    case    CLOSE_ITEM :                            /*    Item 8    */
  606.     //                if ( ( whichWindow = FrontWindow() ) != NIL_POINTER && whichWindow == gCalcWindow )
  607.     //                {
  608.     //                    DiscardInfo ( whichWindow );
  609.     //                    //DisposeWindow( whichWindow );
  610.     //                    DisposeWindow( gSRegWindow );
  611.     //                    DisposeWindow( gMatEWindow );
  612.     //                    DisposeWindow( gMatDWindow );
  613.     //                    DisposeWindow( gMatCWindow );
  614.     //                    DisposeWindow( gMatBWindow );
  615.     //                    DisposeWindow( gMatAWindow );
  616.     //                    if(gWindowState & gProgWin)
  617.     //                    {
  618.     //                        gWindowState ^= gProgWin;
  619.     //                        checkIt = FALSE;
  620.     //                        CheckItem(GetMenu(PROGRAM_MENU_ID),PROGRAM_ITEM,checkIt);
  621.     //                        DisableItem(GetMHandle(PROGRAM_MENU_ID), 2);
  622.     //                        if(whichWindow != gProgWindow)
  623.     //                        {
  624.     //                            SelectWindow(gProgWindow);
  625.     //                            SetInfo(gProgWindow);
  626.     //                        }
  627.     //                        CloseProgramWindow();
  628.     //                    }
  629.     //                    gWindowState |= gMatWin;
  630.     //                    gWindowState ^= gMatWin;
  631.     //                    checkIt = FALSE;
  632.     //                    CheckItem(GetMenu(WINDOW_MENU_ID),MATRIX_ITEM,checkIt);
  633.     //                    gWindowState |= gRegWin;
  634.     //                    gWindowState ^= gRegWin;
  635.     //                    gWindowState |= gProgWin;
  636.     //                    gWindowState ^= gProgWin;
  637.     //                    CheckItem(GetMenu(WINDOW_MENU_ID),REGISTER_ITEM,checkIt);
  638.     //                    CheckItem(GetMenu(PROGRAM_MENU_ID),PROGRAM_ITEM,checkIt);
  639.     //                    CheckItem(GetMenu(PROGRAM_MENU_ID),DISASSEMBLE_ITEM,checkIt);
  640.     //                    EnableItem(GetMHandle(FILE_MENU_ID), 1);    /* Open Calculator */
  641.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 2);    /* Save Data */
  642.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 3);    /* Save Program */
  643.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 4);    /* New Program */
  644.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 5);    /* CLOSE_PROGRAM */
  645.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 6);    /* LOAD_PROGRAM  */
  646.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 7);    /* LOAD_DATA  */
  647.     //                    DisableItem(GetMHandle(FILE_MENU_ID), 8);    /* CLOSE_CALCULATOR  */
  648.     //                    DisableItem(GetMHandle(WINDOW_MENU_ID), 1);
  649.     //                    DisableItem(GetMHandle(WINDOW_MENU_ID), 2);
  650.     //                    DisableItem(GetMHandle(PROGRAM_MENU_ID), 1);
  651.     //                    DisableItem(GetMHandle(PROGRAM_MENU_ID), 2);
  652.     //                }
  653.     //                /*    else if( ( whichWindow = FrontWindow() ) != NIL_POINTER && whichWindow == gCalcWindow )    */
  654.     //                break;            
  655.         case     QUIT_ITEM :                                /*    Item 4    */
  656.                     error = SetFPos(qRefNum,1,0);            /* II-93, IV-110    */
  657.                     error = FSWrite(qRefNum,&count,&map);    /* II-92, IV-110     */
  658.                     error = FSClose(qRefNum);                        /* II-94, IV-112    */
  659.                     error = SetFPos(pRefNum,1,0);
  660.                     error = FSWrite(pRefNum,&fcount,&frog);
  661.                     error = FSClose(pRefNum);
  662.                     error = FlushVol(NIL,theVRefNum);
  663.                     if(!error);
  664.                     else
  665.                     {
  666.                         /*DebugStr("\pHello from FSWrite error")*/;
  667.                     }
  668.                     DisposeRgn(workRegionH);                    /* release region for TE redraw        */
  669.                     /*FlushVol();*/
  670.                     gDone = TRUE;
  671.                     break;
  672.     }
  673. }
  674.  
  675. /********************** HandleEditChoice ************************/
  676. void    HandleEditChoice(short theItem )
  677. {
  678.     //SystemEdit( theItem - 1 );
  679.     switch (theItem)
  680.     {
  681.         case EditUndo:
  682.                 DoUndo ();
  683.             break;
  684.         case EditCut:
  685.                 DoCut ();
  686.             break;
  687.         case EditCopy:
  688.                 DoCopy ();
  689.             break;
  690.         case EditPaste:
  691.                 DoPaste ();
  692.             break;
  693.         case EditClear:
  694.                 DoClear ();
  695.             break;
  696.     }
  697. }
  698.  
  699.  
  700. /*********************** HandleGraphSubChoice ***********************/
  701. void    HandleGraphSubChoice(short theItem )
  702. {
  703.     WindowPtr        wPtr;
  704.     short            i;
  705.     /*static Boolean    hasPlot;*/
  706.     
  707.     switch ( theItem )
  708.     {
  709.         case NEW_GRAPHICS_WINDOW:
  710.             
  711.             break;
  712.     }
  713. }
  714.  
  715. /*********************** HandleGraphChoice ***********************/
  716. void    HandleGraphChoice(short theItem )
  717. //short    theItem;
  718. {
  719.     WindowPtr        wPtr;
  720.     short            i;
  721.     
  722.     
  723.     switch ( theItem )
  724.     {
  725.         case OPEN_GRAPHICS_WINDOW:
  726.             if((wPtr = get_window(1)) != NIL)    /*    get_window() ; in calc_inits.c    */
  727.             {
  728.                 if(gIsWizard)
  729.                 {
  730.                     PreyMenu = GetMenu(PreyMenuID);
  731.                     InsertMenu(PreyMenu,0);
  732.                     DrawMenuBar();
  733.                 }
  734.                 ShowWindow(wPtr);
  735.                 SelectWindow(wPtr);
  736.                 lastPtr = wPtr;
  737.             }
  738.             break;
  739.     }
  740. }
  741.  
  742. /*********************** HandleDorkChoice ************************/
  743. void    HandleDorkChoice(short theItem )    /* menu name is Stretch&Rotate    */
  744. //short    theItem;
  745. {
  746.     DialogPtr            dStrPtr,dRotPtr;
  747.     WindowPtr            wPtr;
  748.     GrafPtr                oldPort;
  749.     long                ticktime;
  750.     double_t            delX;
  751.     double_t            delY;
  752.     double_t            delZ;
  753.     static                Boolean        useCalc;
  754.     Boolean                checkIt,fineMove = false;
  755.     WRObjsHandle        wr_objs_hndl;
  756.     OSErr                iErr;
  757.     OSErr                 interactErr = noErr;
  758.     LocationNameRec        theLocation;
  759.     PortInfoRec         thePortInfo;
  760.     TargetID             theID;
  761.     AEDesc                 myAddressDesc;
  762.     AppleEvent             aeEvent, aeReply;
  763.     FSSpecPtr             theFileToOpen = nil;
  764.     FSSpec                dirSpec, procSpec;
  765.     AliasHandle            DirAlias, FileAlias;
  766.     ProcessSerialNumber    process;
  767.     ProcessInfoRec        infoRec;
  768.     StandardFileReply    myReply;
  769.     Str31                processName;
  770.     AEDesc                 aeDirDesc, listElem;
  771.     AEDesc                fileList;
  772.     Str255                tWext;    
  773.     Str255                t2Wext;
  774.     short                which,i;
  775.     PPCFilterUPP        myPPCFilter;        /*    mine    */
  776.     AEIdleUPP            myIdleProcPtr;        /*    mine    */
  777.     Str255                fullPath;
  778.     Str255                appName;
  779.     unsigned char        appName2[254];
  780.  
  781.     
  782.     wPtr = FrontWindow();
  783.     if(one_of_mine(wPtr) )
  784.     {
  785.         switch ( theItem )
  786.         {
  787.             case ROTATION_BOX:
  788.                 if((gRotateBox = get_rotation_box()) != NIL)    /*    get_rotation_box() ; in calc_inits.c    */
  789.                 {
  790.                     DisableItem(GetMHandle(DORK_MENU_ID), 1);
  791.                     ShowWindow(gRotateBox);
  792.                     SelectWindow(gRotateBox);
  793.                     wr_objs_hndl = (WRObjs**)GetWRefCon(gRotateBox);
  794.                     (**wr_objs_hndl).paletteSetting = 0;
  795.                     do_rotation_subject(gRotateBox,fineMove);    /*    in calc_contents.c    */
  796.                 }
  797.                 break;
  798.             case STRETCH_BOX:
  799.                 if(( gTheEvent.modifiers & optionKey ) != 0)                            /*    (gTheEvent.modifiers & optionKey)    */
  800.                 {                                                                        /*    (gTheEvent.modifiers & alphaLock)    */
  801.                     if(gTheEvent.modifiers & cmdKey)        which = remoteLaunch;        /*    (gTheEvent.modifiers & cmdKey)        */
  802.                     if(gTheEvent.modifiers & controlKey)    which = localLaunch;        /*    (gTheEvent.modifiers & controlKey)    */
  803.                     if(gTheEvent.modifiers & shiftKey)        which = localWindow;        /*    (gTheEvent.modifiers & shiftKey)    */
  804.                     if (which != remoteLaunch)
  805.                         StandardGetFile(nil, -1, nil, &myReply);
  806.                     else                                                            
  807.                         myReply.sfGood = true;
  808.                     if (myReply.sfGood)
  809.                     {
  810.                         theFileToOpen = &myReply.sfFile;
  811.                            infoRec.processInfoLength = sizeof(ProcessInfoRec);
  812.                            infoRec.processName = &processName[0];
  813.                            infoRec.processAppSpec = &procSpec;
  814.  
  815.                         if (which != remoteLaunch)
  816.                         {
  817.                             iErr = FindAProcess(kFinderType, kSysCreator, &process, &infoRec);
  818.                                                     //#ifdef DEBUGGING
  819.                                                     //    DebugStr("\pRight after FindAProcess");
  820.                                                     //#endif
  821.                             if (iErr == noErr)
  822.                                 iErr = AECreateDesc(typeProcessSerialNumber, (Ptr)&process, sizeof(process), &myAddressDesc);
  823.                                                     //#ifdef DEBUGGING
  824.                                                     //    DebugStr("\pRight after AECreateDesc");
  825.                                                     //#endif
  826.                         }
  827.                         else
  828.                         {
  829.     
  830.                             GetIndString(tWext, kGenStrings, kPPCPrompt1);
  831.                             GetIndString(t2Wext, kGenStrings, kPPCPrompt2);
  832.                             myPPCFilter = NewPPCFilterProc((PPCFilterProcPtr)FinderFilter);        /*    mine    */            
  833.                             iErr = PPCBrowser    (
  834.                                                     tWext,
  835.                                                     t2Wext,
  836.                                                     FALSE,
  837.                                                     &theLocation,
  838.                                                     &thePortInfo,
  839.                                                     myPPCFilter,    /*(PPCFilterProcPtr)FinderFilter,        <-- the way it came    */
  840.                                                     NIL                /* theLocNBPType = */ 
  841.                                                 );
  842.                             if (iErr == noErr)
  843.                             {
  844.                                 theID.name = thePortInfo.name;
  845.                                   theID.location = theLocation;
  846.                                 iErr = AECreateDesc(typeTargetID, (Ptr)&theID, sizeof(theID), &myAddressDesc);
  847.                             }
  848.                         }
  849.                         if (iErr == noErr)
  850.     /************/        {
  851.                             iErr = AECreateAppleEvent    (
  852.                                                             kFinderType, kAEOpenSelection,
  853.                                                             &myAddressDesc, kAutoGenerateReturnID,
  854.                                                             kAnyTransactionID, &aeEvent
  855.                                                         );
  856.                             AEDisposeDesc(&myAddressDesc);
  857.                                             //#ifdef DEBUGGING
  858.                                             //    DebugStr("\pRight after AECreateAppleEvent");
  859.                                             //#endif
  860.                             if (iErr == noErr)
  861.                             {
  862.                                 if(which != remoteLaunch)
  863.                                 { 
  864.                                      iErr = FSMakeFSSpec(theFileToOpen->vRefNum, theFileToOpen->parID, nil, &dirSpec);
  865.                                     NewAlias(nil, &dirSpec, &DirAlias);
  866.                                 }
  867.                                 switch (which)
  868.                                 {
  869.                                     case localLaunch:
  870.                                         NewAlias(nil, theFileToOpen, &FileAlias);
  871.                                                     //#ifdef DEBUGGING
  872.                                                     //    DebugStr("\pRight after NewAlias");
  873.                                                     //#endif
  874.                                         break;
  875.                                     case localWindow:
  876.                                         NewAlias(nil, &dirSpec, &FileAlias);
  877.                                         //myIdleProcPtr = NewAEIdleProc((IdleProcPtr)idleProc);
  878.                                         myIdleProcPtr = NewAEIdleProc((ProcPtr)idleProc);
  879.                                         //interactErr = AEInteractWithUser(kAEDefaultTimeout, nil, (IdleProcPtr)idleProc);
  880.                                         interactErr = AEInteractWithUser(kAEDefaultTimeout, nil, myIdleProcPtr);
  881.                                         if (interactErr == noErr)
  882.                                             SetFrontProcess(&process);
  883.                                         break;
  884.                                     case remoteLaunch:
  885.                                         iErr = GetPathAndName(fullPath, appName);
  886.                                         if (iErr == noErr)
  887.                                         {
  888.                                             /* NewAliasMinimalFromFullPath (geez what a lot of typing) creates an alias that does NOT */
  889.                                             /* have a file ID, just builds based on what it has, the path.  So we don't need to */
  890.                                             /* connect to another machine or file server to make this alias, which is why this thing works. */
  891.                                             
  892.                                            // for(i = 1;i <= appName[0];i++)
  893.                                            // {
  894.                                            //     appName2[i] = appName[i];
  895.                                            // }
  896.                                             
  897.                                            // NewAliasMinimalFromFullPath(appName[0], &appName2[1], "", "", &FileAlias);
  898.                                            NewAliasMinimalFromFullPath(appName[0], &appName[1], "\p", "\p", &FileAlias);
  899.                                            /*    NewAliasMinimalFromFullPath(fullPath[0], (Ptr)&fullPath[1], "", "", &DirAlias);    old way    */
  900.                                            NewAliasMinimalFromFullPath(fullPath[0], &fullPath[1], "\p", "\p", &DirAlias);
  901.                                         }
  902.                                         break;
  903.                                 }
  904.                                 if (iErr == noErr)
  905.                                 {
  906.                                     iErr = AECreateList(nil, 0, false, &fileList);
  907.                                     
  908.                                     /*  create the folder  descriptor */
  909.                                     HLock((Handle)DirAlias);
  910.                                     AECreateDesc(typeAlias, (Ptr)*DirAlias, GetHandleSize((Handle)DirAlias), &aeDirDesc);
  911.                                     HUnlock((Handle)DirAlias);
  912.                                     if ((iErr = AEPutParamDesc(&aeEvent, keyDirectObject, &aeDirDesc)) == noErr)
  913.                                     {
  914.                                         /* done with the desc, kill it */
  915.                                         AEDisposeDesc(&aeDirDesc);
  916.                                         /*  create the file descriptor and add to aliasList */
  917.                                         HLock((Handle)FileAlias);
  918.                                         AECreateDesc(typeAlias, (Ptr)*FileAlias, GetHandleSize((Handle)FileAlias), &listElem);
  919.                                         HLock((Handle)FileAlias);
  920.                                         iErr = AEPutDesc(&fileList, 0, &listElem);
  921.                                     }
  922.                                     if (iErr == noErr)
  923.                                     {
  924.                                         AEDisposeDesc(&listElem);
  925.                                         
  926.                                         /* Add the file alias list to the event */
  927.                                         iErr = AEPutParamDesc(&aeEvent, aeSelectionKeyword, &fileList);
  928.                                         AEDisposeDesc(&fileList);
  929.                                         
  930.                                         if (iErr == noErr)
  931.                                             iErr = AESend(&aeEvent, &aeReply, kAENoReply + kAEAlwaysInteract + kAECanSwitchLayer,
  932.                                                            kAENormalPriority, kAEDefaultTimeout, nil, nil);
  933.                                     }
  934.                                 }
  935.                                 AEDisposeDesc(&aeEvent);
  936.                             }
  937.                         }
  938.                     }
  939.                     if ((Handle)DirAlias)
  940.                         DisposHandle((Handle)DirAlias);
  941.                     if ((Handle)FileAlias)
  942.                         DisposHandle((Handle)FileAlias);
  943.                 }
  944.                 else if((gStretchBox = get_stretch_box()) != NIL)    /*    get_stretch_box() ; in calc_inits.c    */
  945.                 {
  946.                     DisableItem(GetMHandle(DORK_MENU_ID), 2);
  947.                     ShowWindow(gStretchBox);
  948.                     SelectWindow(gStretchBox);
  949.                     do_stretch_subject(gStretchBox);
  950.                 }
  951.                 break;
  952.         }
  953.     }
  954.     else
  955.     {
  956.         #ifdef      powerc
  957.             StopAlert (NOT_GRAPHICS_WINDOW, (UniversalProcPtr)NIL);
  958.         #else
  959.             StopAlert (NOT_GRAPHICS_WINDOW,    NIL);
  960.         #endif      /* powerc */    
  961.     }
  962. }
  963.  
  964.  
  965. /********************* MyHandleHelpCommand ***********************/
  966. void    MyHandleHelpCommand(short theItem )
  967. {
  968.     MenuHandle    myHelpMenuHandle;
  969.     short        origHelpItems, numItems;
  970.     short        gMyHelpItem1,gMyHelpItem2;
  971.     OSErr        myErr;
  972.     
  973.     myErr = HMGetHelpMenuHandle(&myHelpMenuHandle);
  974.     if(myErr == noErr)
  975.     {
  976.         numItems = CountMItems(myHelpMenuHandle);
  977.         origHelpItems = numItems - kNumMyHelpItems;
  978.         if(theItem > origHelpItems)
  979.         {
  980.             gMyHelpItem1 = origHelpItems + 3;
  981.             gMyHelpItem2 = origHelpItems + 4;
  982.             if(theItem == gMyHelpItem1)
  983.             {
  984.                 //GetHelp();
  985.             }
  986.             else if(theItem == gMyHelpItem2)
  987.             {
  988.                 HelpGetProc();
  989.             }
  990.                         /*MyHelp(theItem);*/
  991.         }
  992.     }
  993. }
  994.  
  995.  
  996. /* Show only FInders */
  997. pascal Boolean FinderFilter(LocationNamePtr locationName, PortInfoPtr thePortInfo)
  998. {
  999. #pragma unused (locationName)
  1000.     OSType type;
  1001.     
  1002.     if (thePortInfo->name.portKindSelector == ppcByString) {
  1003.         BlockMove(thePortInfo->name.u.portTypeStr + 1, (Ptr)&type, 4);
  1004.         /* The BlockMove is so that we don't get an address error
  1005.         ** on a 68000-based machine due to referencing a long at
  1006.         ** an odd-address. */
  1007.         if (type == kSysCreator)
  1008.             return(true);
  1009.     }
  1010.     return(false);
  1011. }
  1012.  
  1013. pascal Boolean idleProc(EventRecord *eventIn, long *sleep, RgnHandle *mouseRgn)
  1014. {
  1015.     Boolean                gInBackground;
  1016.     
  1017.     switch (eventIn->what) {
  1018.         case nullEvent:
  1019.             /* no nul processing in this sample */
  1020.             *sleep = 0;
  1021.             mouseRgn = nil;
  1022.             break;
  1023.         case updateEvt:
  1024.         case activateEvt:
  1025.             DrawMain((WindowPtr)eventIn->message);          /* draw whatever window needs an update */
  1026.             break;
  1027.         case app4Evt:
  1028.             switch ((gERecord.message >> 24) & 0x0FF) {     /* high byte of message */
  1029.                 case suspendResumeMessage:                  /* suspend/resume is also an activate/deactivate */
  1030.                     gInBackground = (gERecord.message & kResumeMask) == 0;
  1031.                     break;
  1032.             }
  1033.             break;
  1034.             
  1035.     }
  1036.     return(false);                                          /* I'll wait forever */
  1037. }
  1038.  
  1039.  
  1040. void DrawMain(WindowPtr drawIt)
  1041. {
  1042.     Handle theText;
  1043.     BeginUpdate(drawIt);
  1044.     SetPort(drawIt);
  1045.     EraseRect(&drawIt->portRect);
  1046.     theText = GetResource(kTextType, kTextResID);
  1047.     if (theText) {
  1048.         Rect textRect;
  1049.         HLock(theText);
  1050.         HUnlock(theText);
  1051.         textRect = drawIt->portRect;
  1052.         InsetRect(&textRect, 5, 5);
  1053.         TextBox(*theText, GetHandleSize(theText), &textRect, 0);
  1054.         ReleaseResource(theText);
  1055.     }
  1056.     EndUpdate(drawIt);
  1057. }
  1058.  
  1059.  
  1060. OSErr GetPathAndName(Str255 fullPath, Str255 appName)
  1061. {
  1062.     DialogPtr tdial = GetNewDialog(kPathDialog, nil, (WindowPtr)-1);
  1063.     short hitItem = 0;
  1064.     Str255 tempString;
  1065.     short where;
  1066.   // ModalFilterUPP    gMyStandardFilterUPP;
  1067.     
  1068.    // ModalFilterProcPtr filterIt = nil;
  1069.     ModalFilterUPP filterIt = nil;
  1070.     
  1071.     OSErr retVal = userCanceledErr;
  1072.     SetDialogDefaultItem(tdial, ok);
  1073.     SetDialogCancelItem(tdial, cancel);
  1074.     SetDialogTracksCursor(tdial, true);
  1075.     filterIt = NewModalFilterProc(filterIt);
  1076.    //gMyStandardFilterUPP = NewModalFilterProc(gMyStandardFilterUPP);    /*    new    */
  1077.    GetStdFilterProc(&filterIt);
  1078.     ShowWindow(tdial);
  1079.     DrawDialog(tdial);
  1080.     do {
  1081.         //ModalDialog((ModalFilterProcPtr)filterIt, &hitItem);
  1082.         ModalDialog(/*(ModalFilterUPP)gMyStandardFilterUPP*/nil, &hitItem);
  1083.     }
  1084.             while (hitItem != ok && hitItem != cancel);
  1085.     if (hitItem == ok) {
  1086.         GetIText((Handle)SnatchHandle(tdial, kEditLineItem), tempString);
  1087.         /* now parse backwards to find the last colon, which is seperating the file name from the path */
  1088.         where = tempString[0];
  1089.         while (tempString[where] != kColon && where > 0)
  1090.             where--;
  1091.         if (where > 0) {
  1092.             BlockMove((Ptr)&tempString[0], (Ptr)&appName[0], tempString[0] + 1);
  1093.             BlockMove((Ptr)&tempString[0], (Ptr)&fullPath[0], where + 1);       /* include the colon */
  1094.             fullPath[0] = where;
  1095.             retVal = noErr;
  1096.         }
  1097.     }
  1098.     DisposDialog(tdial);
  1099.     
  1100.     return(retVal);
  1101. }
  1102.  
  1103. ControlHandle SnatchHandle(DialogPtr thebox, short theGetItem)
  1104. {
  1105.     short itemtype;
  1106.     Rect itemrect;
  1107.     Handle thandle;
  1108.     
  1109.     GetDItem(thebox, theGetItem, &itemtype, &thandle, &itemrect);
  1110.     return((ControlHandle)thandle);
  1111. }
  1112.  
  1113. /* end SnatchHandle */
  1114.  
  1115.  
  1116.  
  1117. OSErr FindAProcess(OSType typeToFind, OSType creatorToFind, ProcessSerialNumberPtr processSN, ProcessInfoRecPtr infoRecToFill)
  1118. {
  1119.     ProcessSerialNumber tempPSN;
  1120.     OSErr myErr = noErr;
  1121.     tempPSN.lowLongOfPSN = kNoProcess;
  1122.     processSN->lowLongOfPSN = kNoProcess;
  1123.     processSN->highLongOfPSN = kNoProcess;
  1124.     do {
  1125.         myErr = GetNextProcess(processSN);
  1126.         if (myErr == noErr)
  1127.             GetProcessInformation(processSN, infoRecToFill);
  1128.     }
  1129.             while ((infoRecToFill->processSignature != creatorToFind || infoRecToFill->processType != typeToFind) ||
  1130.                    myErr != noErr);
  1131.     
  1132.     return(myErr);
  1133. }
  1134.